package com.rill.service.imp;

import org.springframework.mail.MailException;
import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;

import com.rill.service.MailService;

public class MailServiceImp implements MailService {
	private MailSender mailSender;
    private SimpleMailMessage mailMessage;//邮件模板
    
	public MailSender getMailSender() {
		return mailSender;
	}
	public void setMailSender(MailSender mailSender) {
		this.mailSender = mailSender;
	}
	public SimpleMailMessage getMailMessage() {
		return mailMessage;
	}
	public void setMailMessage(SimpleMailMessage mailMessage) {
		this.mailMessage = mailMessage;
	}
	
    public void sendMail() {
        System.out.println("-----------发送邮件!---------");
        try {
            mailSender.send(this.mailMessage);
        } catch (MailException e) {
            e.printStackTrace();
        }
        System.out.println("-----------发送成功!---------");
    }

}
